<?php
try {
    $user = "root";
    $pass = "123456";
    $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
    var_dump($dbh);
//    $sth = $dbh->query("SELECT 1 + 1");
    $sth = $dbh->query("SELECT * FROM student");
    var_dump($sth);
    $row = $sth->fetchAll();
    var_dump($row);
//    foreach ($dbh->query('SELECT * from FOO') as $row) {
//        print_r($row);
//    }
    $dbh = null;
} catch (PDOException $e) {
    print "Error!: " . $e->getMessage() . "<br/>";
    die();
}


